﻿using UnityEngine;
using System.Collections;
using System.Collections.Generic;
public delegate bool BoolDelegateVe3(Vector3 v3);
public delegate int IntDeleGatCreateStoneID();
public delegate int IntDelegate();
public delegate float FloatDelegate();
public delegate Transform[] TransformsDelegate();
public delegate void VoidDelegateGObj(GameObject g1);
public delegate void VoidDelegateVe3(Vector3 ve3);
public delegate void VoidDelegateVe2(Vector2 ve2);
public delegate void VoidDelegateHit(RaycastHit hit);
public delegate void VoidDelegate();
public delegate void VoidDelegateCommandIdJsonNodeVoidDelegateJsonNode(NetCommand id, ListJsonData data, VoidDelegateJsonNode cb);
public delegate void VoidDelegateIntStringVoidDelegate(int i1, string s1, VoidDelegate cb);
public delegate void VoidDelegateStringStringVoidDelegate(string i1, string s1, VoidDelegate cb);
public delegate void VoidDelegateJsonNodeVoidDelegate(VoidDelegate cb);
public delegate void VoidDelegateJsonNode(JSON.JSONNode node);
public delegate void VoidDelegateString(string str);
public delegate void VoidDelegateInt(int i1);
public delegate void VoidDelegateTransformIntArr(Transform t1, int[] i1);
public delegate void VoidDelegateIntArr(int[] i1);
public delegate void VoidDelegateIntString(int i1,string s2);
public delegate void VoidDelegateFloat(float f1);
public delegate void VoidDelegateIntInt(int i1,int i2);
//public delegate void VoidDelegateValueIntInt(ValueInt vi, int i1);
public delegate void VoidDelegateCollider(Collider collider);
public delegate void VoidDelegateTransformFloat(Transform t1,float f2);
public delegate void VoidDelegateTransform(Transform t1);
public delegate void VoidDelegateJsonDate(ListJsonData j1);

#region Game
public class SceneType{
	public const string Logon = "Logon";
	public const string Home = "Home";
	public const string Battle = "Battle";
	/// <summary>
	/// 装备列表的顺序映射
	/// </summary>

}
public enum ItemType{
	Money = 1,
	Weapon = 2,
	Cloth = 3,
	Head = 4,
	Fashion = 5,
	Monster = 7,
	Boss = 8,
	/// <summary>
	/// 符文
	/// </summary>
	Rune = 9,
	Chests = 10,
	SkillClick = 61,
	SkillDrag = 62,
	SkillDoubleFingerLongPress = 63,
	SkillSingleFingerLongPress = 64,
}

/// <summary>
/// 所有的常数
/// </summary>
public class Constant{
	public static int[] ItemPartTypeMap = new int[]{5,2,3,4};
	public static string[] ItemQuality = new string[]{ "q1", "q2", "q3", "q4" };
	public static string[] ActorAttribute = new string[] {
		"无",
		"天神暴击率增加",
		"天神暴击伤害增加",
		"天神攻击速度增加",
		"增加怪物血量",
		"增加怪物攻击",
		"增加首领血量",
		"增加首领攻击",
		"神力减少消耗",
		"神力恢复速度",
		"技能范围增加",
		"技能延时减少",
	};
}
#endregion
#region 网络协议
public class NetJSONType{
	/// <summary>
	/// 服务器的UUID
	/// </summary>
	public const string uuid = "uuid";
	/// <summary>
	/// 客户端的UUID
	/// </summary>
	public const string UUID = "UUID";
	/// <summary>
	/// 快速登录
	/// </summary>
	public const string Simple = "Simple";
	/// <summary>
	/// 是否断线重连
	/// </summary>
	public const string Repeat = "Repeat";
	/// <summary>
	/// 协议状态
	/// </summary>
	public const string State = "State";
	/// <summary>
	/// 数据结构
	/// </summary>
	public const string Data = "Data";
	/// <summary>
	/// 协议：102  是否第一次登录 
	/// </summary>

	public const string sceneInfo = "sceneInfo";
	public const string Arawd = "Arawd";
	public const string Boss = "boss2";
	public const string GameTime = "GameTime";
	public const string Guard = "boss1";
	public const string MonsterGroup = "monsterGroup";
	public const string MonsterPortal = "monsterPortal";
	public const string IsFirst	= "isFirst";
	public const string Rank = "Rank";
	public const string ID = "ID";
	/// <summary>
	/// 玩家等级
	/// </summary>
	public const string lv = "lv";
	/// <summary>
	/// 金币
	/// </summary>
	public const string gold = "gold";

	public const string box = "box";
	/// <summary>
	/// 能量
	/// </summary>
	public const string energy = "energy";
	/// <summary>
	/// 角色ID
	/// </summary>
	public const string roleId = "roleId";
	/// <summary>
	/// 新手引导
	/// </summary>
	public const string guidance = "guidance";

    /// <summary>
    /// 关卡ID
    /// </summary>
    public const string scneneid = "sceneId";

    /// <summary>
    /// 玩家装备
    /// </summary>
    public const string Equip = "equip";

    /// <summary>
    /// 奖励信息
    /// </summary>
    public const string Reward = "reward";
    public const string Reward_bossCard = "bossCard";

	/// <summary>
	/// 钻石
	/// </summary>
	public const string diamond ="diamond";
	public const string honor = "honor";
	public const string loginTime = "loginTime";
	public const string name = "name";
	public const string roleName = "roleName";
	public const string mapID = "mapID";
	public const string exp = "exp";
	public const string selectID = "SelectID";

    ////Item数据
    public const string ItemType = "type";
    public const string ItemInfo = "info";
    public const string ItemIndex = "index";

	//数组
	public const string idlists = "idList";

}
public enum NetCommand
{
	ENull = -1,
	ETestAddItem = 99,//测试：添加物品

	ELoginUser = 102,//登陆协议
	EPlayerName = 104,//取名协议
	EResetData = 199,//数据重置协议
	//游戏服务器角色协议start
	ECreateRole = 201,//创建角色协议_201
	ERandomName = 202,//随机名字协议_202
	EHeroesRiseOrder = 204,//英雄升阶协议_204	

	///穿上装备
	ERoleEquipment = 204, 
	///升级装备
	EUpgradeEquipment = 206,
	///出售装备
	ESaleItems = 207,

	EPartChangeColor = 208,//部位改色协议
	EPartUnlock = 210,//部位解锁
	EPartChange = 211,//更换花纹
	EarmUnLock = 213,//武器解锁
	EarmChange = 214,//武器更换
	EarmLevel = 215,//武器升级
	EGameTimeandEnergy = 113,//体力恢复时间校验_113
	//游戏服务器角色协议end

	//游戏服务器道具，背包协议start
    BackpackListInfo = 203, ////获取背包列表信息协议_203
    
    EEquipItems = 205,//获取装备信息_205	

//	EdvancedEquipment = 304,//进阶装备_304	
		
	EBuyEquipBackpackGrid = 306,//购买装备背包格子_306	
	EBuyItemsBackpackGrid = 307,//购买物品背包格子_307	
	EfragmentConvert = 312,//碎片兑换_312	
	EItemReplace = 313,//换装备*/
	//游戏服务器道具，背包协议end

	//游戏服务器关卡协议start
    EMapSearchList = 301, //获取地图搜索列表协议
    EEnterLevel = 302,  //进入关卡协议
	EFinishLevel = 303, // 结束关卡战斗协议
    EGuidance = 304,//新手引导




	ELevelsList = 501,//获取关卡列表信息协议_501	
	ELevelLock = 507,//获取关卡解锁
	ELevelRank = 508,//关卡排行协议
	EHomeAllBoxInfo = 401,//请求宝箱仓库所有信息_401	
	EHomeDeblockBox = 402,//解锁宝箱_402
	EHomeOpenBox = 403,//打开宝箱_403
	EHomeNewBoxSlot = 404, // 开启新的宝箱槽
	EHomeRefreshBlackMarket = 405, // 刷新黑市
	EHomeBlackMarketBuy = 406, // 购买黑市宝箱
	EHomeBuyBoxGoldDiamond = 407, // 购买宝箱 金币 钻石
//	ELevelDetal = 402,//请求关卡详细信息协议_402
	ECompleteLevel = 503,//完成关卡协议_404	
//	EPropsPurchase = 405,//购买道具协议_405	
//	EPushPlayerUpgrade = 406, //玩家升级推送协议_406	
//	EBuyLevelEnterNum = 407,//购买关卡次数协议_407	
	EUseProp = 408,//使用关卡道具协议_408	




    EChangeUserExpAndLv = 993, //修改玩家经验等级

	//游戏服务器关卡协议end










	//游戏服务器商店协议start
	EProductListInStore = 1101,//获取商品列表信息协议_1101	
	EBuyItemInStore = 1102,//购买商品协议_1102	
	EBuyTiLiInfo = 1103,//购买体力所需价格协议_1103	
	EBuyTiLiInStore = 1104,//购买体力协议_1104	
	//游戏服务器商店协议end


	//游戏服务器神秘商店协议start
	EProductListInSS = 1201,//获取商店信息协议_1201	
	EBuyItemInSS = 1202,//购买商品协议_1202	
	EFlushProductListInSS = 1203,//刷新商店信息协议_1203	
	BuySSBackpackGrid = 1204,//购买商店格子协议_1204	
	//游戏服务器神秘商店协议end
}
#endregion
//[System.Serializable]
//public class DataValue{
//	protected VoidDelegate _onDataChange;
//	public void SetCallBack(VoidDelegate callback){
//		_onDataChange = callback;
//
//	}
//	protected void OnDataChange(){
//		if (_onDataChange != null)
//			_onDataChange ();
//	}
//}
//[System.Serializable]
//public class DataInt:DataValue{
//	public int _value = 0;
//	public int _max = -1; 
//	public int _min = -1;
//	public bool _useClamp;
//	public void Full(){
//		if (_useClamp)
//			Value = _max;
//	}
//	public int Value{
//		get{ return _value;}
//		set{
//			if (_value != value) {
//				_value = value;
//				if(_useClamp)
//					_value = Mathf.Clamp(_value,_min,_max);
//				OnDataChange();
//			}
//		}
//	}
//	public void SetClamp(int min,int max){
//		_useClamp = true;
//		_max = max;
//		_min = min;
//	}
//	public DataInt(){
//	}
//	public DataInt(int v){
//		Value = v;
//	}
//	public void Add(int v){
//		Value += v;
//	}
//	public void Sub(int v){
//		Value -= v;
//	}
//	public void Set(int v){
//		Value = v;
//	}
//	public static implicit operator int(DataInt target)
//	{
//		return target.Value;	
//	}
//}
//[System.Serializable]
//public class DataFloat:DataValue{
//	public float _value = 0;
//	public float Value{
//		get{ return _value;}
//		set{
//			if (_value != value) {
//				_value = value;
//				OnDataChange();
//			}
//		}
//	}
//
//	public static DataFloat operator ++(DataFloat data)
//	{
//		data.Value++;
//		return data;	
//	}
//	public static DataFloat operator --(DataFloat data)
//	{
//		data.Value--;
//		return data;	
//	}
//	public static bool operator ==(DataFloat data,float target)
//	{
//		return data.Value == target;	
//	}
//	public static bool operator !=(DataFloat data,float target)
//	{
//		return data.Value != target;	
//	}
//	public static implicit operator DataFloat(float target)
//	{
//		DataFloat data = new DataFloat ();
//		data.Value = target;
//		return data;	
//	}
//	public static implicit operator float(DataFloat target)
//	{
//		return target.Value;	
//	}
//}
//[System.Serializable]
//public class DataBool:DataValue{
//	public bool _value = false;
//	public bool Value{
//		get{ return _value;}
//		set{
//			if (_value != value) {
//				_value = value;
//				OnDataChange();
//			}
//		}
//	}
//	public static bool operator ==(DataBool data,bool target)
//	{
//		return data.Value == target;	
//	}
//	public static bool operator !=(DataBool data,bool target)
//	{
//		return data.Value != target;	
//	}
//	public static implicit operator DataBool(bool target)
//	{
//		DataBool data = new DataBool ();
//		data.Value = target;
//		return data;	
//	}
//	public static implicit operator bool(DataBool target)
//	{
//		return target.Value;	
//	}
//}
public enum enHomeViewID{
	Null= -1,
	shop = 0,
	skill = 1,
	role = 2,
	map = 3,
	chat = 4,
}